const Ws = require('ws')

const server = new Ws.Server({ port: 3009 })

server.on('open', () => {
    console.log('open');
})
server.on('close', () => {
    console.log('close');
})
server.on('error', () => {
    console.log('error');
})
server.on('connection', (ws) => {
    console.log('connection');
    ws.on('message', (e) => {
        server.clients.forEach(e1 => {
            e1.send(e)
        })
    })
})